Skip to content

Remove dead code in preferredProvider fallback chain#1154

Closed
cursor[bot] wants to merge 1 commit intocodething/648ca884-claudefrom
cursor/preferred-provider-fallback-c4c9
Closed

Remove dead code in preferredProvider fallback chain#1154
cursor[bot] wants to merge 1 commit intocodething/648ca884-claudefrom
cursor/preferred-provider-fallback-c4c9

Conversation

@cursor
Copy link
Contributor

@cursor cursor bot commented Mar 17, 2026

Summary

Removes dead code in the preferredProvider fallback chain in ProviderCommandReactor.ts.

Problem

The expression currentProvider ?? options?.provider ?? threadProvider contained a dead middle operand. The validation guard at lines 215–221 already ensures that if options.provider is defined, it must equal threadProvider. Therefore, options?.provider can never produce a value different from threadProvider, making it misleading dead code that could confuse future contributors into thinking explicit provider selection influences session routing.

Fix

Simplified the expression to currentProvider ?? threadProvider, which is behaviorally identical but accurately reflects the actual fallback logic.

Open in Web Open in Cursor 

Note

Remove options?.provider from ProviderCommandReactor preferredProvider fallback chain

In ProviderCommandReactor.ts, the start handler previously resolved preferredProvider as currentProvider ?? options?.provider ?? threadProvider. The middle term is removed, so options.provider is no longer consulted. Behavioral Change: callers passing options.provider will have it silently ignored; only currentProvider and threadProvider are used.

Macroscope summarized a98a939.

The middle operand `options?.provider` in the nullish coalescing chain
`currentProvider ?? options?.provider ?? threadProvider` is dead code.
The validation guard at lines 215-221 already ensures options.provider
equals threadProvider when defined, so it can never produce a different
value. Simplified to `currentProvider ?? threadProvider`.

Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions bot added size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants